from scipy.fft import fft
import numpy as np

# 生成信号
t = np.linspace(0, 1, 1000, endpoint=False)
signal = np.sin(2 * np.pi * 5 * t)

# 计算傅里叶变换
spectrum = fft(signal)